﻿
Public Module filename_fix

#If RETIRED Then
    Public Function suitInFileName(ByVal c As Char) As Boolean
        'If c = "/" Or c = "\" Or c = ":" Or c = "*" Or c = "?" Or c = "|" _
        '   Or c = """" Or c = "<" Or c = ">" Or c < " " Or c > "~" Then
        If c = ":" OrElse c = "*" OrElse c = "?" OrElse c = "|" OrElse c = """" _
            OrElse c = "<" OrElse c = ">" OrElse c < " " OrElse c > "~" Then
            Return False
        Else
            Return True
        End If
    End Function

    Public Function suitInFileName(ByVal c As Char) As Boolean
        Return Not invalidPathChar(c) AndAlso Not invalidFilenameChar(c)
    End Function
#End If

    Public Function suitInFileName(ByVal c As Char) As Boolean
        Return Not invalidPathChar(c)
    End Function

    Public Sub fixFileName(ByRef str As String)
        Dim i As Int32
        Dim len As Int32 = str.Length
        i = 0
        While i < strlen(str)
            If Not suitInFileName(str(i)) Then
                strrmv(str, i, 1)
            Else
                i += 1
            End If
        End While
    End Sub

End Module
